<?php
    include("room_class.php");
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of room_group_class
 *
 * @author GodMark
 */
class RoomGroup {
    private $xmlReturn;
    
    public function RoomGroup($array){
        if(isset($array))
        {
            $xmlString = "";
            $xmlString .="<RoomGroup>";
            for($i=0; $i<count($array); $i++)
            {
                $xmlString .="<Room>";

                    $xmlString .="<numberOfAdults>";
                    $xmlString .="".$array[$i]->GetNumberOfAdults();
                    $xmlString .="</numberOfAdults>";
                
                    $xmlString .="<numberOfChildren>";
                    $xmlString .=$array[$i]->GetNumberOfChildren();
                    $xmlString .="</numberOfChildren>";
                
              
                    $xmlString .="<childAges>";
                    
                    $limit = count($array[$i]->GetChildrenAges());
                    for($j=0; $j<$limit; $j++)
                    {
                        //print_r(htmlspecialchars($xmlString));
                        //print_r($array[$i]->GetChildrenAges()[$j].PHP_EOL);
                        $xmlString .=$array[$i]->GetChildrenAges()[$j];
                        if($limit-1 != $j)
                        {
                            $xmlString .=",";
                        }
                    }
                    $xmlString .="</childAges>";
                
                $xmlString .="</Room>";
            }
            $xmlString .="</RoomGroup>";
            //print_r(htmlspecialchars($xmlString));
            $this->xmlReturn = $xmlString;
        }

    }
    function GetXMLRequest() {
        return $this->xmlReturn;
    }

    
}

?>
